import Vue from 'vue'
import VueRouter from 'vue-router'

const Home = () =>
  import ('../components/Home.vue')

const Books = () =>
  import ('../components/books/books.vue')
Vue.use(VueRouter)

const Words = () =>
  import ('../components/books/words.vue')

const Test = () =>
  import ('../components/test/Test.vue')

const Result = () =>
  import ('../components/test/Result.vue')

const Battle = () =>
  import ('../components/battle/Battle.vue')

const routes = [{
    path: '',
    redirect: '/test'
  },
  {
    path: '/home',
    component: Home,
    redirect: '/books',
    children: [{
        path: '/books',
        component: Books,
      },
      {
        path: '/books/words',
        component: Words,
      },
    ]
  },
  {
    path: '/test',
    component: Test,
  },
  {
    path: '/result',
    component: Result
  },
  {
    path: '/battle',
    component: Battle
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router